﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

///<summary>
//主题者 
///</summary>
public class BalloonSubject : MonoBehaviour
{
	Test01 balloonA;
	BalloonCommponent balloonB;
	public delegate void Add(int num);
	Add add;

    // Start is called before the first frame update
    void Start()
    {
		//加入需要观察的角色
	    balloonA = GameObject.Find("A").GetComponent<Test01>();
	    balloonB = GameObject.Find("B").GetComponent<BalloonCommponent>();

		add = balloonA.Add;
		add += balloonB.Add;
		//加入事件  
		GetComponent<Button>().onClick.AddListener(()=> 
		{
			add(Random.Range(0,4537));
		});
    }

	
}
